<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}">
    <script th:src="@{/static/jquery-2.1.4.js}" type="text/javascript" charset="utf-8"></script>
    <script th:src="@{/static/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
    <script th:src="@{/static/mylayer.js}" type="text/javascript" charset="utf-8"></script>
</head>
<body>
    <table class="layui-table" lay-skin="line" style="width: 95%; margin-left: auto; margin-right: auto; margin-top: 20px; margin-bottom: 20px;">
        <colgroup>
            <col width="5%">
            <col width="25%">
            <col width="25%">
            <col width="15%">
            <col width="15%">
            <col width="15%">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th></th>
            <th>商品图片</th>
            <th>商品名称</th>
            <th>商品价格</th>
            <th>数量</th>
            <th>小计</th>
        </tr>
        </thead>
        <tbody id="LAY_OrderCartList">

        </tbody>
    </table>
    <script>
        var queryString = window.location.search;
        var urlParams = new URLSearchParams(queryString);
        var orderNo = urlParams.get("orderNo");
        $.post(
            '/order/orderItemByOrderNo',
            {'orderNo': orderNo},
            function (result) {
                if (result.code == 0) {
                    var html = '';
                    var count = 1; // 初始化计数器
                    $('#LAY_OrderCartList').empty();
                    $(result.data).each(function () {
                        html += '<tr>'
                        html += '	<th>'+count+'</th>'
                        html += '	<th><img src="'+this.productImage+'"></th>'
                        html += '	<th>'+this.productName+'</th>'
                        html += '	<th>'+this.currentUnitPrice+'元</th>'
                        html += '	<th>'+this.quantity+'</th>'
                        html += '	<th>'+this.currentUnitPrice+'元</th>'
                        html += '</tr>'
                        count++;
                    });
                    $('#LAY_OrderCartList').append(html);
                }
            },
            'json'
        );
    </script>
</body>
</html>
